package com.yswl.pri.picture.entry;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yswl.pri.common.utils.MResultUtil;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import yswl.com.klibrary.util.DateJsonDeserializer;

/**
 * Created by kangpAdministrator on 2018/6/27 0027.
 * Emial kangpeng@yunhetong.net
 */

public class LuckImgBean {
    public String id;
    public String src;


    public static ArrayList<LuckImgBean> jsonToList(JSONObject json) {
        JSONArray objarray = MResultUtil.getArrayObjDATA(json, "list");
        if (objarray == null || objarray.length() <= 0) return null;
        Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new DateJsonDeserializer()).create();
        ArrayList<LuckImgBean> list = gson.fromJson(objarray.toString(), new TypeToken<List<LuckImgBean>>() {
        }.getType());
        return list;
    }

}
